import java.util.Scanner;

public class demo05 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n1=sc.nextInt();
        int n2=sc.nextInt();
        int count=0;
        for (int i = n1; i <= n2; i++) {
            int tmp=i;
            if(check(tmp)){
                count++;
            }
        }
        System.out.println(count);
    }
    public static boolean check(int n){
        for (int i = 2; i < n; i++) {
            if(n%i==0){
                return false;
            }
        }
        return true;
    }
}
